package com.zjw.vehicle;

import com.google.inject.assistedinject.FactoryModuleBuilder;
import org.opentcs.customizations.kernel.KernelInjectionModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CustomKernelInjectionModule extends KernelInjectionModule {
    private static final Logger LOG = LoggerFactory.getLogger(CustomKernelInjectionModule.class);

    @Override
    protected void configure() {

        CustomCommAdapterConfiguration configuration = getConfigBindingProvider().get(CustomCommAdapterConfiguration.PREFIX, CustomCommAdapterConfiguration.class);

        if (!configuration.enable()) {
            LOG.info("Example communication adapter disabled by configuration.");
            return;
        }

        install(new FactoryModuleBuilder().build(CustomAdapterComponentsFactory.class));
        vehicleCommAdaptersBinder().addBinding().to(CustomCommAdapterFactory.class);
    }

}
